<template>
  <div id="app">
    <router-view />
    <theme-picker />
  </div>
</template>

<script>
import ThemePicker from "@/components/ThemePicker"

export default {
  name: "App",
  components: { ThemePicker }
}
</script>

<script>
export default {
  name: 'YourComponent',
  mounted() {
    // 检查是否已加载，避免重复加载
    if (window.EmbedLiteSDK) {
      this.initEmbedLiteSDK();
      return;
    }

    // 动态创建script标签加载SDK
    const script = document.createElement('script');
    script.src = 'https://agi-dev-platform-web.bj.bcebos.com/ai_apaas/embed/output/embedLiteSDK.js?responseExpires=0';
    script.onload = () => {
      // 脚本加载完成后初始化
      this.initEmbedLiteSDK();
    };
    document.head.appendChild(script);
  },
  methods: {
    initEmbedLiteSDK() {
      // 初始化 EmbedLiteSDK
      new window.EmbedLiteSDK({
        appId: '67676eb1-73ea-49a0-9b28-e47e06dfcf32',
        code: 'embed9FPJkhiDykLeWmM5zsnJ'
        // 可以根据SDK文档，添加其他配置参数，例如 container: '#embedlite-container'
      });
    }
  },
  beforeUnmount() {
    // 如果需要，在组件销毁时进行清理操作
    // 例如：window.embedLiteInstance?.destroy();
  }
}
</script>

<style scoped>
#app .theme-picker {
  display: none;
}
</style>
